package com.ruoyi.system.service.impl;

import com.ruoyi.system.domain.SchoolUser;
import com.ruoyi.system.mapper.SchoolMapper;
import com.ruoyi.system.service.ISchoolService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SchoolServiceImpl implements ISchoolService {
    @Autowired
    private SchoolMapper schoolMapper;
    //添加
    @Override
    public String add(SchoolUser schoolUser) {
        int add = schoolMapper.add(schoolUser);
        if(add==1){
            return "添加成功";
        }else {
            return "添加失败";
        }

    }

    //删除
    @Override
    public String delete(Integer id) {
        int delete = schoolMapper.delete(id);
        if(delete==1){
            return "删除成功";
        }
        else {
            return "删除失败";
        }
    }

    //修改
    @Override
    public String update(SchoolUser schoolUser) {
        int update = schoolMapper.update(schoolUser);
        if(update==1){
            return "修改成功";
        }else {
            return "修改失败";
        }
    }

    //查询
    @Override
    public List<SchoolUser> query(Integer id) {
        List<SchoolUser> query = schoolMapper.query(id);

        return query;
    }
}
